package com.scwatch.core.web.back;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.scwatch.common.orm.LimitRequest;
import com.scwatch.common.orm.RowSide;
import com.scwatch.common.util.Dates;
import com.scwatch.common.web.Servlets;
import com.scwatch.core.constant.Constants;
import com.scwatch.core.domain.*;
import com.scwatch.core.html.HtmlGenerator;
import com.scwatch.core.html.HtmlService;
import com.scwatch.core.service.*;
import com.scwatch.core.support.Backends;
import com.scwatch.core.support.CmsException;
import com.scwatch.core.support.Context;
import com.scwatch.ext.domain.LiveBroadcast;
import com.scwatch.ext.service.LiveBroadcastService;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.joda.time.DateTime;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.web.PageableDefault;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;

import javax.servlet.http.HttpServletRequest;
import java.util.*;

import static com.scwatch.core.constant.Constants.*;

/**
 *  时讯/24小时
 * 
 * @author gujianlin
 * 
 */
@Controller
@RequestMapping("/core/current_hour")
public class CurrentHourNewController {
	private static final Logger logger = LoggerFactory.getLogger(CurrentHourNewController.class);

    public static final int INCLUDE_CHILDREN = 0;
    public static final int INCLUDE_MULTI = 1;
    public static final int MAIN_NODE = 2;

    /**
     * 24小时/时讯查询
     * @param queryNodeId 栏目id
     * @param queryNodeType
     * @param queryDate 日期
     * @param queryInfoPermType 权限
     * @param queryStatus 状态
     * @param returnUrl 返回url
     * @param targetNodeId 目标栏目
     * @param orderId
     * @param showInfoId
     * @param request
     * @param modelMap
     * @return 结果页面
     */
//    @RequiresPermissions("core:current_hour:list")
    @RequestMapping("list.do")
    public String list(Integer queryNodeId, Integer queryNodeType,String queryDate, Integer queryInfoPermType, String queryStatus,
                                 String returnUrl,Integer targetNodeId,Integer orderId,Integer showInfoId,
                                 HttpServletRequest request, org.springframework.ui.Model modelMap) {
        String url=returnUrl;
        queryNodeType = queryNodeType == null ? 0 : queryNodeType;
        Integer siteId = Context.getCurrentSiteId();
        User user = Context.getCurrentUser();
        Integer nodeId = queryNodeId;
        Integer mainNodeId = null;
        String treeNumber = null;
        Node queryNode = null;
        if (queryNodeId != null) {
            queryNode = nodeQuery.get(queryNodeId);
        }
        if (queryNode != null) {
            if (queryNodeType == INCLUDE_MULTI) {
                nodeId = queryNodeId;
            } else if (queryNodeType == MAIN_NODE) {
                mainNodeId = queryNodeId;
            } else {
                treeNumber = queryNode.getTreeNumber();
            }
        }
        Map<String, String[]> params = Servlets.getParamValuesMap(request, Constants.SEARCH_PREFIX);
        int infoPermType = user.getInfoPermType(siteId);
        if (queryInfoPermType != null && queryInfoPermType > infoPermType) {
            infoPermType = queryInfoPermType;
        }
        boolean allInfoPerm = user.getAllInfoPerm(siteId);
        Sort defSort = new Sort(Sort.Direction.DESC, "priority", "publishDate", "id");
        LimitRequest limitRequest=new LimitRequest(null,null, defSort);

        List<Attribute> attributeList = attributeService.findList(siteId);
        List<Info> infoList=infoQuery.findListByParam(null,new Integer[]{queryNodeId}, null,null,
                null,new Integer[]{siteId},null,null, null,
                null, null,null, null, null,
                Dates.getOnedayStartDate(queryDate),Dates.getOnedayEndDate(queryDate), null, null,null,
                null, null, null,new String[]{Info.NORMAL},null,
                null, null, null, null, null, null,null,null, limitRequest);

        modelMap.addAttribute("infoList", infoList);
        modelMap.addAttribute("attributeList", attributeList);
        modelMap.addAttribute("queryNodeId", queryNodeId);
        modelMap.addAttribute("queryNodeType", queryNodeType);
        modelMap.addAttribute("queryInfoPermType", queryInfoPermType);
        modelMap.addAttribute("queryStatus", queryStatus);
        modelMap.addAttribute("node",queryNode);
        modelMap.addAttribute("returnUrl",returnUrl);
        modelMap.addAttribute("targetNodeId",targetNodeId);
        modelMap.addAttribute("orderId",orderId);
        modelMap.addAttribute("showInfoId",showInfoId);
        if(queryDate==null){
            modelMap.addAttribute("today", new Date());
        }else{
            modelMap.addAttribute("today", Dates.formatDateStr(queryDate,null));
        }

        return url;
    }

    /**
     * 查询新闻（时讯添加新闻时使用）
     * @param queryNodeId 栏目id
     * @param queryNodeType 类型
     * @param queryInfoPermType 权限
     * @param queryStatus 状态
     * @param returnUrl 返回url
     * @param targetNodeId 目标id
     * @param orderId
     * @param showInfoId
     * @param isHour 是否24小时
     * @param showCrawler 爬虫库 草稿箱
     * @param queryDate 日期
     * @param pageable 分页
     * @param request
     * @param modelMap
     * @return 结果页面
     */
//    @RequiresPermissions("core:current_hour:chooseinfolist")
    @RequestMapping("chooseinfolist.do")
    public String chooseinfolist(Integer queryNodeId, Integer queryNodeType, Integer queryInfoPermType, String queryStatus,
                           String returnUrl,Integer targetNodeId,Integer orderId,Integer showInfoId,String isHour,
                                 @RequestParam(defaultValue = "true") boolean showCrawler,String queryDate,
                           @PageableDefault(sort = {"publishDate", "id"}, direction = Sort.Direction.DESC) Pageable pageable,
                           HttpServletRequest request, org.springframework.ui.Model modelMap) {
        String url=returnUrl;
        queryNodeType = queryNodeType == null ? 0 : queryNodeType;
        Integer siteId = Context.getCurrentSiteId();
        User user = Context.getCurrentUser();
        Integer nodeId = queryNodeId;
        Integer mainNodeId = null;
        String treeNumber = null;
        Node queryNode = null;
        if (queryNodeId != null) {
            queryNode = nodeQuery.get(queryNodeId);
        }
        if (queryNode != null) {
            if (queryNodeType == INCLUDE_MULTI) {
                nodeId = queryNodeId;
            } else if (queryNodeType == MAIN_NODE) {
                mainNodeId = queryNodeId;
            } else {
                treeNumber = queryNode.getTreeNumber();
            }
        }
        Map<String, String[]> params = Servlets.getParamValuesMap(request, Constants.SEARCH_PREFIX);
        int infoPermType = user.getInfoPermType(siteId);
        if (queryInfoPermType != null && queryInfoPermType > infoPermType) {
            infoPermType = queryInfoPermType;
        }
        boolean allInfoPerm = user.getAllInfoPerm(siteId);

        Integer [] nodeIds=null;
        if(StringUtils.isNotBlank(isHour) && "0".equals(isHour)){
            showCrawler=false;
        }

        queryStatus="A";

        String startDate=Dates.formatDate(Dates.getOnedayStartDate(queryDate),"yyyy-MM-dd");
        DateTime dateTime=DateTime.parse(startDate).plusDays(1);
        String endDate=Dates.formatDate(dateTime.toDate(),"yyyy-MM-dd");
//        params.put("GTE_publishDate_Date",new String[]{startDate});
//        paramsparams.put("LT_publishDate_Date",new String[]{endDate});
        Site site=Context.getCurrentSite();
        if(showCrawler){  //查询爬虫库 草稿箱
            nodeIds=getNodeIdsByFlag(Constants.MODEL_FLAG_DRAFTS_NODE,site,user);
            queryStatus=null;
        }else{
            nodeIds=getNodeIdsByFlag(Constants.MODEL_FLAG_NEWS,site,user);
        }
        Page<Info> pagedList = infoQuery.findAll(null,siteId, mainNodeId,nodeId, treeNumber, null,true,
                1, queryStatus, params, pageable,nodeIds);

        List<Attribute> attributeList = attributeService.findList(siteId);
        modelMap.addAttribute("pagedList", pagedList);
        modelMap.addAttribute("attributeList", attributeList);
        modelMap.addAttribute("queryNodeId", queryNodeId);
        modelMap.addAttribute("queryNodeType", queryNodeType);
        modelMap.addAttribute("queryInfoPermType", queryInfoPermType);
        modelMap.addAttribute("queryStatus", queryStatus);
        modelMap.addAttribute("node",queryNode);
        modelMap.addAttribute("returnUrl",returnUrl);
        modelMap.addAttribute("targetNodeId",targetNodeId);
        modelMap.addAttribute("orderId",orderId);
        modelMap.addAttribute("showInfoId",showInfoId);
        modelMap.addAttribute("isHour",isHour);
        modelMap.addAttribute("showCrawler",showCrawler);
        modelMap.addAttribute("queryDate",queryDate);
        return returnUrl;
    }


    /**
     * 时讯添加新闻
     * @param ids
     * @param infoId
     * @param orderId
     * @param targetNodeId 目标栏目
     * @param queryNodeId
     * @param queryNodeType
     * @param returnUrl
     * @param queryDate 日期
     * @param queryInfoPermType
     * @param queryStatus 状态
     * @param request
     * @param ra
     * @return 结果页面
     */
//    @RequiresPermissions("core:current_hour:ref")
    @RequestMapping("currentRefInfo.do")
    public String currentRefInfo(Integer[] ids,Integer infoId,Integer orderId,Integer targetNodeId,
                               Integer queryNodeId, Integer queryNodeType,String returnUrl,String queryDate,
                               Integer queryInfoPermType, String queryStatus, HttpServletRequest request, RedirectAttributes ra) {
        Site site = Context.getCurrentSite();
        User user = Context.getCurrentUser();
        ids=new Integer[1];
        ids[0]=infoId;
        validateIds(ids, site.getId());
//        bean.setId(null);
//        InfoDetail detail=bean.getDetail();
//        detail.setId(null);
//        InfoBuffer infoBuffer=bean.getBuffer();
//        infoBuffer.setId(null);
//        bean.setBuffer(infoBuffer);
//        Integer id1=bean.getId();
//        bean.setInfoNodes(null);
        //Info a=null;
//        Object b=null;
//
//
//
//        Object ab=null;
//        try {
//            ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
//            ObjectOutputStream out= new ObjectOutputStream(byteOut);
//            out.writeObject(queryInfo);
//            //写对象，序列化
//            ByteArrayInputStream byteIn = new ByteArrayInputStream(byteOut.toByteArray());
//            ObjectInputStream inputStream=new ObjectInputStream(byteIn);
//            ab=inputStream.readObject();
//            //读对象，反序列化
////            ByteArrayOutputStream byteOut1 = new ByteArrayOutputStream();
////            ObjectOutputStream out1= new ObjectOutputStream(byteOut1);
////            out.writeObject(queryInfo);
//
//        }catch (Exception e){
//        }

//        Info bean=new Info();
//        InfoDetail infoDetail=queryInfo.getDetail();
//        infoDetail.setId(null);
//        bean.setDetail(infoDetail);
          List<Info> beans = infoService.move(ids, targetNodeId);
//        if(ids!=null){
////            infoService.batchupdateHtmlThread(Arrays.asList(ids),false,"firePostMove");
//        }
//        infoService.save(bean, queryInfo.getDetail(),null, null, null, null, null, null, null, null,
//                null, null, null, targetNodeId, user.getId(), "A", site.getId());
//        infoService.updateInfoRef(ids,targetNodeId,orderId);
//        htmlService.makeNode(targetNodeId);

        String ip = Servlets.getRemoteAddr(request);
        for (Integer id : ids) {
            Info info=infoQuery.get(id);
            info.setStatus("A");
            htmlService.makeInfo(info);
//            htmlService.makeNode(targetNodeId);
            logService.operation("core:info:focusRefInfo", info.getTitle(), null, info.getId(), ip, user.getId(), site.getId());
            logger.info("{} focusRefInfo Info, title={}.", info.getTitle(),user.getId());
        }
        ra.addAttribute("queryNodeId", queryNodeId);
        ra.addAttribute("orderId", orderId);
        ra.addAttribute("queryNodeType", queryNodeType);
        ra.addAttribute("queryInfoPermType", queryInfoPermType);
        ra.addAttribute("queryStatus", queryStatus);
        ra.addFlashAttribute(MESSAGE, OPERATION_SUCCESS);
        ra.addAttribute("returnUrl",returnUrl );
        ra.addAttribute("showInfoId", infoId);
        ra.addAttribute("queryDate", queryDate);
        return "redirect:list.do";
    }

    /**
     * 24小时、时讯，清除新闻
     * @param ids
     * @param infoId 新闻id
     * @param orderId
     * @param targetNodeId 目标栏目
     * @param queryNodeId
     * @param queryNodeType
     * @param queryDate 日期
     * @param returnUrl
     * @param queryInfoPermType
     * @param queryStatus 状态
     * @param request
     * @param ra
     * @return 结果页面
     */
//    @RequiresPermissions("core:info:current:delref")
    @RequestMapping("delCurrentRefInfo.do")
    public String delCurrentRefInfo(Integer[] ids,Integer infoId,Integer orderId,Integer targetNodeId,
                                  Integer queryNodeId, Integer queryNodeType,String queryDate,String returnUrl,
                                  Integer queryInfoPermType, String queryStatus, HttpServletRequest request, RedirectAttributes ra) {
        Site site = Context.getCurrentSite();
        User user = Context.getCurrentUser();
        ids=new Integer[1];
        ids[0]=infoId;
        validateIds(ids, site.getId());
        for (Integer id : ids) {
            Info bean = infoQuery.get(id);
            if (!bean.isDataPerm(user) || !bean.isAuditPerm(user)) {
                throw new CmsException("accessDenied");
            }
        }
        String ref=infoNodeService.deleteByNodeIdAndInfoId(targetNodeId,infoId);
        List<Info> infos=infoService.delete(ids);
//        infoService.batchupdateHtmlThread(Arrays.asList(ids),true,"firePostDelete");
        String ip = Servlets.getRemoteAddr(request);
        for (Info bean:infos) {
            logService.operation("core:info:delCurrentRefInfo", bean.getTitle(), null, bean.getId(), ip, user.getId(), site.getId());
            logger.info("{} delCurrentRefInfo Info, title={}.", bean.getTitle(),user.getId());

        }
        if(StringUtils.isNotBlank(ref) && "1".equals(ref)){
            List<Info> beans = infoService.delete(ids);
//            infoService.batchupdateHtmlThread(Arrays.asList(ids),true,"firePostDelete");
        }
        ra.addAttribute("queryNodeId", targetNodeId);
        ra.addAttribute("orderId", orderId);
        ra.addAttribute("queryNodeType", queryNodeType);
        ra.addAttribute("queryInfoPermType", queryInfoPermType);
        ra.addAttribute("queryStatus", queryStatus);
        ra.addFlashAttribute(MESSAGE, OPERATION_SUCCESS);
        ra.addAttribute("returnUrl", returnUrl);
        ra.addAttribute("showInfoId", infoId);
        ra.addAttribute("queryDate",queryDate);
        return "redirect:list.do";
    }

//    @RequiresPermissions("core:info:create")
    @RequestMapping("infocreate.do")
    public String infocreate(Integer id, Integer queryNodeId, Integer queryNodeType, Integer queryInfoPermType,
                             String queryStatus, HttpServletRequest request, org.springframework.ui.Model modelMap) {
        Site site = Context.getCurrentSite();
        if (id != null) {
            Info bean = infoQuery.get(id);
            Backends.validateDataInSite(bean, site.getId());
            modelMap.addAttribute("bean", bean);
        }
        Node node;
        if (queryNodeId == null) {
            node = nodeQuery.findRoot(site.getId());
            if (node == null) {
                throw new CmsException("info.error.nodeNotFound");
            }
        } else {
            node = nodeQuery.get(queryNodeId);
        }
        Backends.validateDataInSite(node, site.getId());
        Model model = node.getInfoModel();
        List<Attribute> attrList = attributeService.findList(site.getId());
        List<MemberGroup> groupList = memberGroupService.findList();
        String orgTreeNumber = site.getOrg().getTreeNumber();
        modelMap.addAttribute("model", model);
        modelMap.addAttribute("node", node);
        modelMap.addAttribute("attrList", attrList);
        modelMap.addAttribute("groupList", groupList);
        modelMap.addAttribute("orgTreeNumber", orgTreeNumber);
        modelMap.addAttribute("queryNodeId", queryNodeId);
        modelMap.addAttribute("queryNodeType", queryNodeType);
        modelMap.addAttribute("queryInfoPermType", queryInfoPermType);
        modelMap.addAttribute("queryStatus", queryStatus);
        modelMap.addAttribute(OPRT, CREATE);
        return "core/current_hour/info_form";
    }

//    @RequiresPermissions("core:info:save")
    @RequestMapping("infosave.do")
    public String infosave(Info bean, InfoDetail detail, Integer[] nodeIds, Integer[] specialIds, Integer[] viewGroupIds,
                           Integer[] viewOrgIds, Integer[] attrIds, Integer nodeId, String tagKeywords,String queryDate,
                           @RequestParam(defaultValue = "false") boolean draft, String[] imagesName, String[] imagesText,
                           String[] imagesImage, String[] filesName, String[] filesFile, Long[] filesLength, String redirect,
                           Integer queryNodeId, Integer queryNodeType, Integer queryInfoPermType, String queryStatus,
                           Integer targetNodeId,Integer infoId,Integer[] voteIds,
                           HttpServletRequest request, RedirectAttributes ra) {
        nodeId=targetNodeId;
        Integer siteId = Context.getCurrentSiteId();
        Integer userId = Context.getCurrentUserId();
        Map<String, String> customs = Servlets.getParamMap(request, "customs_");
        Map<String, String> clobs = Servlets.getParamMap(request, "clobs_");
        if (StringUtils.isBlank(detail.getMetaDescription())) {
            String title = detail.getTitle();
            detail.setMetaDescription(Info.getDescription(clobs, title));
        }
        String[] tagNames = splitTagKeywords(tagKeywords);
        Map<String, String> attrImages = Servlets.getParamMap(request, "attrImages_");
        for (Map.Entry<String, String> entry : attrImages.entrySet()) {
            entry.setValue(StringUtils.trimToNull(entry.getValue()));
        }
        List<InfoImage> images = new ArrayList<InfoImage>();
        if (imagesName != null) {
            InfoImage infoImage;
            for (int i = 0, len = imagesName.length; i < len; i++) {
                if (StringUtils.isNotBlank(imagesName[i]) || StringUtils.isNotBlank(imagesText[i])
                        || StringUtils.isNotBlank(imagesImage[i])) {
                    infoImage = new InfoImage(imagesName[i], imagesText[i], imagesImage[i]);
                    images.add(infoImage);
                }
            }
        }
        List<InfoFile> files = new ArrayList<InfoFile>();
        if (filesName != null) {
            InfoFile infoFile;
            for (int i = 0, len = filesFile.length; i < len; i++) {
                if (StringUtils.isNotBlank(filesName[i]) && StringUtils.isNotBlank(filesFile[i])) {
                    infoFile = new InfoFile(filesName[i], filesFile[i], filesLength[i]);
                    files.add(infoFile);
                }
            }
        }
        if(specialIds!=null && specialIds.length==1){
            if(specialIds[0]==null){
                specialIds=null;
            }
        }
        if(voteIds!=null && voteIds.length==1){
            if(voteIds[0]==null){
                voteIds=null;
            }
        }
        String status = draft ? Info.DRAFT : null;
        Info result=infoService.save(bean, detail, nodeIds, specialIds, viewGroupIds, viewOrgIds,voteIds,customs, clobs, images, files,
                attrIds, attrImages, tagNames, nodeId, userId, status, siteId);
        String ip = Servlets.getRemoteAddr(request);
//        infoService.updateHtmlThread(result.getId(),false,"firePostSave");
        logService.operation("opr.info.add", bean.getTitle(), null, bean.getId(), ip, userId, siteId);
        logger.info("save Info, title={}.", bean.getTitle());
        ra.addAttribute("queryNodeId", queryNodeId);
        ra.addAttribute("queryNodeType", queryNodeType);
        ra.addAttribute("queryInfoPermType", queryInfoPermType);
        ra.addAttribute("queryStatus", queryStatus);
        ra.addAttribute("queryDate", queryDate);
        ra.addFlashAttribute(MESSAGE, SAVE_SUCCESS);
        if (Constants.REDIRECT_LIST.equals(redirect)) {
            ra.addAttribute("returnUrl","core/current_hour/currentnews_list");
            return "redirect:list.do";
        } else if (Constants.REDIRECT_CREATE.equals(redirect)) {
            return "redirect:infocreate.do";
        } else {
            ra.addAttribute("id", bean.getId());
            return "redirect:infoedit.do";
        }
    }


    /**
     * 跳转到时讯栏目新闻编辑页面
     * @param id 新闻id
     * @param position
     * @param queryNodeId 栏目
     * @param queryDate 查询日期
     * @param returnUrl 返回url
     * @param queryNodeType
     * @param queryInfoPermType
     * @param queryStatus 状态
     * @param pageable 分页
     * @param request
     * @param modelMap
     * @return 结果页面
     */
//    @RequiresPermissions("core:info:edit")
    @RequestMapping("infoedit.do")
    public String infoedit(Integer id, Integer position, Integer queryNodeId,String queryDate,String returnUrl,
                           @RequestParam(defaultValue = "0") int queryNodeType, Integer queryInfoPermType, String queryStatus,
                           @PageableDefault(sort = {"publishDate", "id"}, direction = Sort.Direction.DESC) Pageable pageable,
                           HttpServletRequest request, org.springframework.ui.Model modelMap) {
        Site site = Context.getCurrentSite();
        User user = Context.getCurrentUser();
        Info bean = infoQuery.get(id);
        Backends.validateDataInSite(bean, site.getId());
        if (!bean.isDataPerm(user)) {
            throw new CmsException("accessDenied");
        }
        Integer nodeId = null;
        Integer mainNodeId = null;
        String treeNumber = null;
        Node queryNode = null;
        if (queryNodeId != null) {
            queryNode = nodeQuery.get(queryNodeId);
        }
        if (queryNode != null) {
            if (queryNodeType == INCLUDE_MULTI) {
                nodeId = queryNodeId;
            } else if (queryNodeType == MAIN_NODE) {
                mainNodeId = queryNodeId;
            } else {
                treeNumber = queryNode.getTreeNumber();
            }
        }
        Map<String, String[]> params = Servlets.getParamValuesMap(request, Constants.SEARCH_PREFIX);
        Integer infoPermType = user.getInfoPermType(site.getId());
        if (queryInfoPermType != null && queryInfoPermType > infoPermType) {
            infoPermType = queryInfoPermType;
        }
        boolean allInfoPerm = user.getAllInfoPerm(site.getId());
        RowSide<Info> side = infoQuery.findSide(site.getId(), mainNodeId, nodeId, treeNumber, user.getId(), allInfoPerm,
                infoPermType, queryStatus, params, bean, position, pageable.getSort());
        modelMap.addAttribute("bean", bean);
        modelMap.addAttribute("side", side);
        modelMap.addAttribute("position", position);

        Node node = bean.getNode();
        Model model = bean.getModel();
        List<Attribute> attrList = attributeService.findList(site.getId());
        List<MemberGroup> groupList = memberGroupService.findList();
        String orgTreeNumber = site.getOrg().getTreeNumber();


        //查询主播数据
        String anchorStr=getAnchorsJosnStr(site);
        modelMap.addAttribute("anchorStr",anchorStr);
        //获取新闻所属主播
        if(bean!=null){
            List<Node> selectAnchors=bean.getNodesExcludeMain();
            String selectAnchorStr="";
            StringBuffer buffer=new StringBuffer("");
            if(selectAnchors!=null && selectAnchors.size()>0) {
                for (Node anchor : selectAnchors) {
                    buffer.append(anchor.getId()).append(",");
                }
            }
            selectAnchorStr=buffer.toString();
            if(StringUtils.isNotBlank(selectAnchorStr)){
                selectAnchorStr=selectAnchorStr.substring(0, selectAnchorStr.length() - 1);
            }
            modelMap.addAttribute("selectAnchorStr",selectAnchorStr);
        }

        //查询市州地区数据
        String cityNodeStr=getCityNodesJosnStr(site);
        modelMap.addAttribute("cityNodeStr",cityNodeStr);
        //查询发布到市州栏目数据
        modelMap.addAttribute("selectCityNodeStr",bean.getCityNodes());

        modelMap.addAttribute("model", model);
        modelMap.addAttribute("node", node);
        modelMap.addAttribute("attrList", attrList);
        modelMap.addAttribute("groupList", groupList);
        modelMap.addAttribute("orgTreeNumber", orgTreeNumber);
        modelMap.addAttribute("queryNodeId", queryNodeId);
        modelMap.addAttribute("queryNodeType", queryNodeType);
        modelMap.addAttribute("queryInfoPermType", queryInfoPermType);
        modelMap.addAttribute("queryStatus", queryStatus);
        modelMap.addAttribute(OPRT, EDIT);
        modelMap.addAttribute("queryDate",queryDate);
        modelMap.addAttribute("returnUrl",returnUrl);
        return "core/current_hour/info_form";
    }


    /**
     * 时讯新闻修改
     * @param bean 新闻主数据对象
     * @param detail 新闻详情对象
     * @param returnUrl 返回url
     * @param queryDate 查询日期
     * @param nodeIds 栏目
     * @param specialIds 专题
     * @param viewGroupIds 浏览权限
     * @param viewOrgIds
     * @param attrIds 属性
     * @param nodeId 栏目
     * @param tagKeywords 关键词
     * @param pass 通过
     * @param voteIds 投票
     * @param remainDescription
     * @param imagesName 图片名称
     * @param imagesText 图片文本
     * @param imagesImage 图片集
     * @param filesName 文件名称
     * @param filesFile 文件集
     * @param filesLength 文件大小
     * @param position
     * @param queryNodeId 栏目
     * @param queryNodeType 类型
     * @param queryInfoPermType 权限
     * @param queryStatus 状态
     * @param redirect
     * @param request
     * @param ra
     * @return 结果页面
     */
//    @RequiresPermissions("core:info:update")
    @RequestMapping("infoupdate.do")
    public String infoupdate(@ModelAttribute("bean") Info bean, @ModelAttribute("detail") InfoDetail detail,String returnUrl,String queryDate,
                             Integer[] nodeIds, Integer[] specialIds, Integer[] viewGroupIds, Integer[] viewOrgIds, Integer[] attrIds,
                             Integer nodeId, String tagKeywords, @RequestParam(defaultValue = "false") boolean pass,Integer[] voteIds,
                             @RequestParam(defaultValue = "false") boolean remainDescription, String[] imagesName, String[] imagesText,
                             String[] imagesImage, String[] filesName, String[] filesFile, Long[] filesLength, Integer position,
                             Integer queryNodeId, Integer queryNodeType, Integer queryInfoPermType, String queryStatus, String redirect,
                             String cityNodes,
                             HttpServletRequest request, RedirectAttributes ra) {
        Site site = Context.getCurrentSite();
        User user = Context.getCurrentUser();
        Backends.validateDataInSite(bean, site.getId());
        if (!bean.isDataPerm(user) || !bean.isAuditPerm(user)) {
            throw new CmsException("accessDenied");
        }
        Map<String, String> customs = Servlets.getParamMap(request, "customs_");
        Map<String, String> clobs = Servlets.getParamMap(request, "clobs_");
        if (!remainDescription || StringUtils.isBlank(detail.getMetaDescription())) {
            String title = detail.getTitle();
            detail.setMetaDescription(Info.getDescription(clobs, title));
        }
        String[] tagNames = splitTagKeywords(tagKeywords);
        Map<String, String> attrImages = Servlets.getParamMap(request, "attrImages_");
        for (Map.Entry<String, String> entry : attrImages.entrySet()) {
            entry.setValue(StringUtils.trimToNull(entry.getValue()));
        }
        List<InfoImage> images = new ArrayList<InfoImage>();
        if (imagesName != null) {
            InfoImage infoImage;
            for (int i = 0, len = imagesName.length; i < len; i++) {
                if (StringUtils.isNotBlank(imagesName[i]) || StringUtils.isNotBlank(imagesImage[i])) {
                    infoImage = new InfoImage(imagesName[i], imagesText[i], imagesImage[i]);
                    images.add(infoImage);
                }
            }
        }
        List<InfoFile> files = new ArrayList<InfoFile>();
        if (filesName != null) {
            InfoFile infoFile;
            for (int i = 0, len = filesFile.length; i < len; i++) {
                if (StringUtils.isNotBlank(filesName[i]) && StringUtils.isNotBlank(filesFile[i])) {
                    infoFile = new InfoFile(filesName[i], filesFile[i], filesLength[i]);
                    files.add(infoFile);
                }
            }
        }
        if(specialIds!=null && specialIds.length==1){
            if(specialIds[0]==null){
                specialIds=null;
            }
        }
        if(voteIds!=null && voteIds.length==1){
            if(voteIds[0]==null){
                voteIds=null;
            }
        }
        if (specialIds == null) {
            specialIds = new Integer[0];
        }
        if (viewGroupIds == null) {
            viewGroupIds = new Integer[0];
        }
        if (viewOrgIds == null) {
            viewOrgIds = new Integer[0];
        }
        if (attrIds == null) {
            attrIds = new Integer[0];
        }
        if (tagNames == null) {
            tagNames = new String[0];
        }
        if(voteIds==null){
            voteIds=new Integer[0];
        }
        bean.setCityNodes(cityNodes);
        infoService.update(bean, detail, nodeIds, specialIds, viewGroupIds, viewOrgIds,voteIds,customs, clobs, images, files,
                attrIds, attrImages, tagNames, nodeId, user, pass, false);
        infoService.saveInfoToCityNode(cityNodes,bean);
//        infoService.updateHtmlThread(bean.getId(),false,"firePostUpdate");
        String ip = Servlets.getRemoteAddr(request);
        logService.operation("opr.info.edit", bean.getTitle(), "cityNodes:"+cityNodes, bean.getId(), ip, user.getId(), site.getId());
        logger.info("update Info, title={}.", bean.getTitle());
        ra.addAttribute("queryNodeId", queryNodeId);
        ra.addAttribute("queryNodeType", queryNodeType);
        ra.addAttribute("queryInfoPermType", queryInfoPermType);
        ra.addAttribute("queryStatus", queryStatus);
        ra.addFlashAttribute(MESSAGE, SAVE_SUCCESS);
        ra.addAttribute("returnUrl",returnUrl);
        ra.addAttribute("queryDate",queryDate);
        if (Constants.REDIRECT_LIST.equals(redirect)) {
            return "redirect:list.do";
        } else {
            ra.addAttribute("id", bean.getId());
            ra.addAttribute("position", position);
            return "redirect:infoedit.do";
        }
    }


    /**
     * 修改新闻发布时间
     * @param infoId 新闻id
     * @param queryNodeId 栏目id
     * @param queryDate 查询时间
     * @param publishDate 发布时间
     * @param returnUrl 返回url
     * @param request 请求对象
     * @param ra
     * @return 结果页面
     */
    @RequiresPermissions("core:info:current_hour:changePublishDate")
    @RequestMapping("changePublishDate.do")
    public String changePublishDate(Integer infoId,Integer queryNodeId,
                                    String queryDate,String publishDate,String returnUrl,
                                    HttpServletRequest request, RedirectAttributes ra) {
        Site site = Context.getCurrentSite();
        User user = Context.getCurrentUser();
        validateIds(new Integer[]{infoId}, site.getId());
        Info bean = infoQuery.get(infoId);
        if (!bean.isDataPerm(user) || !bean.isAuditPerm(user)) {
                throw new CmsException("accessDenied");
        }

        publishDate=Dates.formatDate(bean.getPublishDate(),"yyyy-MM-dd")+" "+publishDate+":00";
        if(bean!=null && bean.getRefInfo()!=null){
            infoService.updatePublishDate(infoId,Dates.formatDateStr(publishDate,null));
            infoService.updatePublishDate(bean.getRefInfo().getId(),Dates.formatDateStr(publishDate,null));
        }else{
            infoService.updatePublishDate(infoId,Dates.formatDateStr(publishDate,null));
        }
        Info info=infoQuery.get(infoId);
        htmlService.makeInfo(info);
        htmlService.makeNode(queryNodeId);
        String ip = Servlets.getRemoteAddr(request);
        logService.operation("core:info:current:changePublishDate", bean.getTitle(), null, bean.getId(), ip, user.getId(), site.getId());
        logger.info("{} changePublishDate Info, title={}.", bean.getTitle(),user.getId());

        ra.addAttribute("queryNodeId", queryNodeId);
        ra.addFlashAttribute(MESSAGE, OPERATION_SUCCESS);
        ra.addAttribute("returnUrl", returnUrl);
        ra.addAttribute("showInfoId", infoId);
        ra.addAttribute("queryDate",queryDate);
        return "redirect:list.do";
    }

    /**
     * 24小时、时讯生成栏目
     * @param queryNodeId 栏目
     * @param queryDate  查询日期
     * @param returnUrl 返回url
     * @param request 请求对象
     * @param ra
     * @return 结果页面
     */
    @RequiresPermissions("core:info:generationHourAndCurrent")
    @RequestMapping("generationHourAndCurrent.do")
    public String generationHourAndCurrent(Integer queryNodeId,String queryDate,String returnUrl,
                                    HttpServletRequest request, RedirectAttributes ra) {
        Site site = Context.getCurrentSite();
        User user = Context.getCurrentUser();
        Node node=null;
        if(queryNodeId!=null && queryDate!=null){
            String paramDate=Dates.formatDate(Dates.formatDateStr(queryDate,"yyyy-MM-dd"),"yyyy-MM-dd");
            node=nodeQuery.get(queryNodeId);
//            htmlGenerator.makeInfo(site.getId(), queryNodeId,node.getName(),true, user.getId());
//            htmlService.makeNode(node,paramDate);
            htmlGenerator.makeNode(site.getId(), node.getId(),node.getName(), true, user.getId(),paramDate);
            String ip = Servlets.getRemoteAddr(request);
            logService.operation("core:info:generationHourAndCurrent", node.getName(), null, node.getId(), ip, user.getId(), site.getId());
            logger.info("{} generationHourAndCurrent Info userId {}", node.getName(),user.getId());
        }
        ra.addAttribute("queryNodeId", queryNodeId);
        ra.addFlashAttribute(MESSAGE, OPERATION_SUCCESS);
        ra.addAttribute("queryDate",queryDate);
        ra.addAttribute("returnUrl",returnUrl);
        return "redirect:list.do";
    }

    @RequiresPermissions("core:hour:edit")
    @RequestMapping("editHour.do")
    public String editHour(Integer id, Integer position, Integer queryNodeId,String queryDate,String returnUrl,
                           @RequestParam(defaultValue = "0") int queryNodeType, Integer queryInfoPermType, String queryStatus,
                           @PageableDefault(sort = {"publishDate", "id"}, direction = Sort.Direction.DESC) Pageable pageable,
                           HttpServletRequest request, org.springframework.ui.Model modelMap) {
        String jspUrl=null;
        Site site = Context.getCurrentSite();
        User user = Context.getCurrentUser();
        Info paramBean = infoQuery.get(id);
        Backends.validateDataInSite(paramBean, site.getId());
        if(paramBean.getRefInfo()!=null){
            Info bean=paramBean.getRefInfo();
            jspUrl="core/current_hour/info_form";

            modelMap.addAttribute("bean", bean);
            modelMap.addAttribute("position", position);

            Node node = bean.getNode();
            Model model = bean.getModel();
            List<Attribute> attrList = attributeService.findList(site.getId());
            List<MemberGroup> groupList = memberGroupService.findList();
            String orgTreeNumber = site.getOrg().getTreeNumber();

            modelMap.addAttribute("model", model);
            modelMap.addAttribute("node", node);
            modelMap.addAttribute("attrList", attrList);
            modelMap.addAttribute("groupList", groupList);
            modelMap.addAttribute("orgTreeNumber", orgTreeNumber);
            modelMap.addAttribute("queryNodeType", queryNodeType);
            modelMap.addAttribute("queryInfoPermType", queryInfoPermType);
            modelMap.addAttribute("queryStatus", queryStatus);
        }else if(paramBean.getRefLive()!=null){
            LiveBroadcast bean=paramBean.getRefLive();
            jspUrl="core/current_hour/livebroadcast_form";
            modelMap.addAttribute("bean", bean);
            modelMap.addAttribute("site", site);
            modelMap.addAttribute("position", position);

        }else if(paramBean.getRefSpec()!=null){
            Special bean=paramBean.getRefSpec();
            jspUrl="core/current_hour/special_form";
            Model model = bean.getModel();
            modelMap.addAttribute("bean", bean);
            modelMap.addAttribute("position", position);
            List<SpecialCategory> categoryList = specialCategoryService
                    .findList(site.getId());
            List<Model> modelList = modelService.findList(site.getId(),
                    Special.MODEL_TYPE);
            modelMap.addAttribute("categoryList", categoryList);
            modelMap.addAttribute("category", bean.getCategory());
            modelMap.addAttribute("modelList", modelList);
            modelMap.addAttribute("model", model);
        }

        modelMap.addAttribute("queryNodeId", queryNodeId);
        modelMap.addAttribute(OPRT, EDIT);
        modelMap.addAttribute("queryDate",queryDate);
        modelMap.addAttribute("returnUrl",returnUrl);
        return jspUrl;
    }

    @RequiresPermissions("core:hourspecial:update")
    @RequestMapping("hourspecialupdate.do")
    public String hourspecialupdate(@ModelAttribute("bean") Special bean,
                         Integer categoryId, Integer modelId, String[] imagesName,
                         String[] imagesText, String[] imagesImage, String[] filesName,
                         String[] filesFile, Long[] filesLength, Integer position,
                         String redirect, HttpServletRequest request, RedirectAttributes ra) {
        Site site = Context.getCurrentSite();
        SpecialCategory category = specialCategoryService.get(categoryId);
        Backends.validateDataInSite(category, site.getId());
        Backends.validateDataInSite(bean, site.getId());
        Map<String, String> customs = Servlets.getParamMap(request,
                "customs_");
        Map<String, String> clobs = Servlets.getParamMap(request, "clobs_");
        List<SpecialImage> images = new ArrayList<SpecialImage>();
        if (imagesName != null) {
            SpecialImage specialImage;
            for (int i = 0, len = imagesName.length; i < len; i++) {
                if (StringUtils.isNotBlank(imagesName[i])
                        || StringUtils.isNotBlank(imagesText[i])
                        || StringUtils.isNotBlank(imagesImage[i])) {
                    specialImage = new SpecialImage(imagesName[i],
                            imagesText[i], imagesImage[i]);
                    images.add(specialImage);
                }
            }
        }
        List<SpecialFile> files = new ArrayList<SpecialFile>();
        if (filesName != null) {
            SpecialFile specialFile;
            for (int i = 0, len = filesFile.length; i < len; i++) {
                if (StringUtils.isNotBlank(filesName[i])
                        && StringUtils.isNotBlank(filesFile[i])) {
                    specialFile = new SpecialFile(filesName[i], filesFile[i],
                            filesLength[i]);
                    files.add(specialFile);
                }
            }
        }
        specialService.update(bean, categoryId, modelId, customs, clobs, images, files);
        logService.operation("opr.hourspecialupdate.update", bean.getTitle(), null,
                bean.getId(), request);
        logger.info("hourspecialupdate Special, title={}.", bean.getTitle());
        ra.addFlashAttribute(MESSAGE, SAVE_SUCCESS);
        if (Constants.REDIRECT_LIST.equals(redirect)) {
            return "redirect:list.do";
        } else {
            ra.addAttribute("id", bean.getId());
            ra.addAttribute("position", position);
            return "redirect:edit.do";
        }
    }


    @ModelAttribute
    public void preloadNodeBean(@RequestParam(required = false) Integer oid, org.springframework.ui.Model modelMap) {
        if (oid != null) {
            Node bean = nodeQuery.get(oid);
            if (bean != null) {
                modelMap.addAttribute("bean", bean);
                NodeDetail detail = bean.getDetail();
                if (detail == null) {
                    detail = new NodeDetail();
                    detail.setId(oid);
                    detail.setNode(bean);
                }
                modelMap.addAttribute("detail", detail);
            }
        }
    }

    @ModelAttribute
    public void preloadInfoBean(@RequestParam(required = false) Integer oid, org.springframework.ui.Model modelMap) {
        if (oid != null) {
            Info bean = infoQuery.get(oid);
            if (bean != null) {
                modelMap.addAttribute("bean", bean);
                InfoDetail detail = bean.getDetail();
                if (detail == null) {
                    detail = new InfoDetail();
                    detail.setId(oid);
                    detail.setInfo(bean);
                }
                modelMap.addAttribute("detail", detail);
            }
        }
    }

	private void validateIds(Integer[] ids, Integer siteId) {
		for (Integer id : ids) {
			Backends.validateDataInSite(nodeQuery.get(id), siteId);
		}
	}

	private Integer[] getInfoPermIds(Integer siteId, Integer parentId) {
		Collection<Role> roles = null;
		if (parentId != null) {
			Node node = nodeQuery.get(parentId);
			if (node != null) {
				roles = node.getInfoPerms();
			}
		}
		if (roles == null) {
			roles = roleService.findList(siteId);
		}
		int len = roles.size();
		Integer[] ids = new Integer[len];
		int i = 0;
		for (Role role : roles) {
			ids[i++] = role.getId();
		}
		return ids;
	}

	private Integer[] getNodePermIds(Integer siteId, Integer parentId) {
		Collection<Role> roles = null;
		if (parentId != null) {
			Node node = nodeQuery.get(parentId);
			if (node != null) {
				roles = node.getNodePerms();
			}
		}
		if (roles == null) {
			roles = roleService.findList(siteId);
		}
		int len = roles.size();
		Integer[] ids = new Integer[len];
		int i = 0;
		for (Role role : roles) {
			ids[i++] = role.getId();
		}
		return ids;
	}

	private Integer[] getViewGroupIds(Integer siteId, Integer parentId) {
		Collection<MemberGroup> groups = null;
		if (parentId != null) {
			Node node = nodeQuery.get(parentId);
			if (node != null) {
				groups = node.getViewGroups();
			}
		}
		if (groups == null) {
			groups = memberGroupService.findList();
		}
		int len = groups.size();
		Integer[] ids = new Integer[len];
		int i = 0;
		for (MemberGroup group : groups) {
			ids[i++] = group.getId();
		}
		return ids;
	}

	private Integer[] getContriGroupIds(Integer siteId, Integer parentId) {
		Collection<MemberGroup> groups = null;
		if (parentId != null) {
			Node node = nodeQuery.get(parentId);
			if (node != null) {
				groups = node.getContriGroups();
			}
		}
		if (groups == null) {
			groups = memberGroupService.findList();
		}
		int len = groups.size();
		Integer[] ids = new Integer[len];
		int i = 0;
		for (MemberGroup group : groups) {
			ids[i++] = group.getId();
		}
		return ids;
	}

	private Integer[] getCommentGroupIds(Integer siteId, Integer parentId) {
		Collection<MemberGroup> groups = null;
		if (parentId != null) {
			Node node = nodeQuery.get(parentId);
			if (node != null) {
				groups = node.getCommentGroups();
			}
		}
		if (groups == null) {
			groups = memberGroupService.findList();
		}
		int len = groups.size();
		Integer[] ids = new Integer[len];
		int i = 0;
		for (MemberGroup group : groups) {
			ids[i++] = group.getId();
		}
		return ids;
	}
    private String[] splitTagKeywords(String tagKeywords) {
        String split = Constants.TAG_KEYWORDS_SPLIT;
        if (StringUtils.isNotBlank(split)) {
            for (int i = 0, len = split.length(); i < len; i++) {
                tagKeywords = StringUtils.replace(tagKeywords, String.valueOf(split.charAt(i)), ",");
            }
        }
        return StringUtils.split(tagKeywords, ',');
    }

    private Integer[] getNodeIdsByFlag(String modelFlag, Site site,User user) {
        Integer [] nodeIds=null;
        Map<String,String[]> paramMap=new HashMap<String,String[]>();
        paramMap.put("EQ_flag",new String[]{modelFlag});
        List<Model> models=modelService.findList(site.getId(),null,paramMap,null);

        paramMap=new HashMap<String,String[]>();
        String[] idsStr;
        if(models!=null && models.size()>0){
            idsStr=new String[models.size()];
            for(int i=0;i<models.size();i++){
                idsStr[i]=models.get(i).getId().toString();
            }
            paramMap.put("EQ_nodeModel.id",idsStr);
        }
        Sort paramSort=new Sort(Sort.Direction.ASC, "treeNumber", "id");
        List<Node>  currentNodeList=nodeQuery.findList(site.getId(),null,
                null,null,true,
                paramMap, paramSort);
//        currentNodeList= user.getInfoPermList(site.getId(), currentNodeList);
        if(currentNodeList!=null){
            nodeIds=new Integer[currentNodeList.size()];
            for(int i=0;i<currentNodeList.size();i++){
                nodeIds[i]=(currentNodeList.get(i).getId());
            }
        }
        return  nodeIds;
    }

    private String getAnchorsJosnStr(Site site){
        //查询主播的父级栏目
        Integer [] nodeIds=getNodeIdsByFlag(Constants.MODEL_FLAG_ANCHOR_DYNAMIC,site,null);
        Integer parentId=null;
        if(nodeIds!=null && nodeIds.length>0){
            parentId=nodeIds[0];
        }
        List<Node> list = nodeQuery.findList(site.getId(), parentId,null, true, null);
        List<Node> removeList=new ArrayList<Node>();
        JSONArray jsonArray=new JSONArray();
        JSONObject anchor=null;
        for(Node n:list){
            if(!Constants.MODEL_FLAG_ANCHOR_DYNAMIC.equals(n.getNodeModel().getFlag())){
                anchor=new JSONObject();
                anchor.put("id",n.getId());
                anchor.put("text",n.getName());
                jsonArray.add(anchor);
            }
        }
        String stringjson = JSON.toJSONString(jsonArray, SerializerFeature.WriteMapNullValue);
        return  stringjson;
    }

    private String getCityNodesJosnStr(Site site){
        //查询市州的父级栏目
        Integer [] nodeIds=getNodeIdsByFlag(Constants.MODEL_FLAG_CITY_STATE,site,null);
        Integer parentId=null;
        if(nodeIds!=null && nodeIds.length>0){
            parentId=nodeIds[0];
        }
        List<Node> list = nodeQuery.findList(site.getId(), parentId,null, true, null);
        List<Node> removeList=new ArrayList<Node>();
        JSONArray jsonArray=new JSONArray();
        JSONObject city=null;
        for(Node n:list){
            if(!Constants.MODEL_FLAG_CITY_STATE.equals(n.getNodeModel().getFlag())){
                city=new JSONObject();
                city.put("id",n.getId());
                city.put("text",n.getName());
                jsonArray.add(city);
            }
        }
        String stringjson = JSON.toJSONString(jsonArray, SerializerFeature.WriteMapNullValue);
        return  stringjson;
    }

    @RequestMapping("editNode.do")
    public String editNode(Integer[] ids,Integer infoId,Integer orderId,Integer targetNodeId,
                                    Integer queryNodeId, Integer queryNodeType,String queryDate,String returnUrl,
                                    Boolean isStick, Boolean bigPic, Integer queryInfoPermType, String queryStatus,HttpServletRequest request, RedirectAttributes ra) {
        Site site = Context.getCurrentSite();
        User user = Context.getCurrentUser();
        ids=new Integer[1];
        ids[0]=infoId;
        validateIds(ids, site.getId());
        for (Integer id : ids) {
            Info bean = infoQuery.get(id);
            if (!bean.isDataPerm(user) || !bean.isAuditPerm(user)) {
                throw new CmsException("accessDenied");
            }
        }
        infoNodeService.updateNodeInfoStickAndPic(targetNodeId,infoId,isStick,bigPic);
        ra.addAttribute("queryNodeId", targetNodeId);
        ra.addAttribute("orderId", orderId);
        ra.addAttribute("queryNodeType", queryNodeType);
        ra.addAttribute("queryInfoPermType", queryInfoPermType);
        ra.addAttribute("queryStatus", queryStatus);
        ra.addFlashAttribute(MESSAGE, OPERATION_SUCCESS);
        ra.addAttribute("returnUrl", returnUrl);
        ra.addAttribute("showInfoId", infoId);
        ra.addAttribute("queryDate",queryDate);
        return "redirect:list.do";
    }

	@Autowired
	private OperationLogService logService;
	@Autowired
	private RoleService roleService;
	@Autowired
	private MemberGroupService memberGroupService;
	@Autowired
	private WorkflowService workflowService;
	@Autowired
	private ModelService modelService;
	@Autowired
	private NodeService service;
	@Autowired
	private NodeQueryService nodeQuery;
    @Autowired
    private AttributeService attributeService;
    @Autowired
    private InfoQueryService infoQuery;
    @Autowired
    private InfoService infoService;
    @Autowired
    private HtmlService htmlService;
    @Autowired
    private InfoNodeService infoNodeService;
    @Autowired
    private SpecialCategoryService specialCategoryService;
    @Autowired
    private SpecialService specialService;
    @Autowired
    private LiveBroadcastService liveBroadcastService;
    @Autowired
    private HtmlGenerator htmlGenerator;


}
